const Controller = require('egg').Controller;
function toInt(str) {
  if (typeof str === 'number') return str;
  if (!str) return str;
  return parseInt(str, 10) || 0;
}

class ArticleController extends Controller {
  async index() {
    const { ctx } = this;
    const res=await ctx.service.article.index.index()
    ctx.helper.success(ctx,res)
  }
  async add() {
    const { ctx } = this;
    const res=await ctx.service.article.index.add()
    ctx.helper.success(ctx,res)
  }
  async edit() {
    const { ctx } = this;
    const res=await ctx.service.article.index.edit()
    ctx.helper.success(ctx,res)
  }
  async show() {
    const { ctx } = this;
    const res=await ctx.service.article.index.show()
    ctx.helper.success(ctx,res)
  }
  async destroy() {
    const ctx = this.ctx;
    const res=await ctx.service.article.index.destroy()
    ctx.helper.success(ctx,res);
  }
}

module.exports = ArticleController;
